package com.cloud.api.myenum;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

import java.util.Objects;

/**
 * @author 杨斌
 * 2025-03-2025-03-20
 */
public enum CompanyEnum implements IEnum<Integer> {
    TaiHang( 1,"山西太行成功汽车销售有限公司"),
    ErBa( 0,"深圳二八开投资集团有限公司");


    CompanyEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    @EnumValue
    @JsonValue
    private Integer value;
    @Getter
    private String desc;

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static String getDesc(Integer value){
        CompanyEnum[] values = CompanyEnum.values();
        for (CompanyEnum companyEnum : values){
            if (Objects.equals(companyEnum.value, value)){
                return companyEnum.desc;
            }
        }
        return "未知";
    }

    public static CompanyEnum getDesc1(Integer value){
        CompanyEnum[] values = CompanyEnum.values();
        for (CompanyEnum companyEnum : values){
            if (Objects.equals(companyEnum.value, value)){
                return companyEnum;
            }
        }
        return null;
    }
}
